#include "earnmoney.h"
#include "basic.h"
#include<QMenuBar>
#include<QAction>
#include<QPainter>
#include<pushbutton_01.h>
#include<QDebug>
#include<QTimer>
#include<QLabel>


EarnMoney::EarnMoney(QWidget *parent) : QMainWindow(parent)
{
    //固定尺寸
    this->setFixedSize(mainSceneWidth,mainSceneHeight);
    //标题
    this->setWindowTitle("攒攒功德");
    //图标
    this->setWindowIcon(QIcon(":/res/Coin0001.png"));

    //创建菜单
    QMenuBar * bar = menuBar();
    this->setMenuBar(bar);
    QMenu* startMenu = bar->addMenu("开始");
    QAction * quitAction = startMenu->addAction("退出");

    connect(quitAction,&QAction::triggered,[=](){
        this->close();
    });

    //返回按钮
    PushButton_01 * back =new PushButton_01(":/res/BackButton.png",":/res/BackButtonSelected.png");
    back->setParent(this);
    back->move(this->width() - back->width(),this->height() - back->height());

    connect(back,&PushButton_01::clicked,[=](){

        QTimer::singleShot(500,this,[=](){
            emit this->EarnSceneBack();
        });

    });


}

void EarnMoney::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QColor color(0,0,0);
    painter.setBrush(color);
    painter.drawRect(this->rect());

}
